<template>
    <view class="pad30 textContent">
        <rich-text :nodes="text"></rich-text>
    </view>
</template>

<script>
    import { getUserAgreement } from '@/api/service.js'
    export default{
        data(){
            return{
                text:'',
                title:'',
                type:''
            }
        },
        onLoad(options) {
            console.log(options.type);
            if(options.type==5){
                this.title = '用户服务协议'
            }else if(options.type==2){
                this.title = '隐私协议'
            }else if(options.type==3){
                this.title = '收支协议'
            }else if(options.type==6){
                this.title = '问诊知情同意书'
            }
            uni.setNavigationBarTitle({
                title:this.title
            });
            this.getText(options);
        },
        methods:{
            getText(options){
                uni.showLoading({
                    title:'加载中'
                });
                getUserAgreement({
                    type:options.type,
                    delFlag :'1'
                }).then(res=>{
                    uni.hideLoading()
                    this.text = res.data.content;

                }).catch(err=>{
                    uni.hideLoading()
                    return this.$util.Tips({
                        title: err
                    });
                })
            }
        }
    }
</script>

<style>
    page{
        background-color: #fff;
    }
    .textContent{
        padding:30rpx;
    }
</style>
